package dbms.parse;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import java_cup.runtime.Symbol;

public class test_lexer {
	public static void main(String argv[]) throws IOException {
		String filename = "src/dbms/test/test3";
		InputStream inp = new FileInputStream(filename);
		Lexer lexer = new Lexer(inp);
		Symbol tok;
		
		do {
			tok = lexer.next_token();
			System.out.println(symnames[tok.sym] + " " + tok.left);
		} while (tok.sym != sym.EOF);

		inp.close();
	}



	static String symnames[] = new String[100];
	static {
		symnames[sym.EOF] = "EOF";
		symnames[sym.INTEGER] = "INTEGER";
		symnames[sym.ID] = "ID";
		symnames[sym.STR] = "STR";
		symnames[sym.SEMICOLON] = "SEMICOLON";
		symnames[sym.SELECT] = "SELECT";
		symnames[sym.FROM] = "FROM";
		symnames[sym.WHERE] = "WHERE";
		symnames[sym.COMMA] = "COMMA";
		symnames[sym.AS] = "AS";
		symnames[sym.AND] = "AND";
		symnames[sym.CHAR] = "CHAR";
		symnames[sym.OR] = "OR";
		symnames[sym.NOT] = "NOT";
		symnames[sym.LPAREN] = "LPAREN";
		symnames[sym.RPAREN] = "RPAREN";
		symnames[sym.EQ] = "EQ";
		symnames[sym.NEQ] = "NEQ";
		symnames[sym.LT] = "LT";
		symnames[sym.LTE] = "LTE";
		symnames[sym.GT] = "GT";
		symnames[sym.GTE] = "GTE";
		symnames[sym.INSERT] = "INSERT";
		symnames[sym.INTO] = "INTO";
		symnames[sym.VALUES] = "VALUES";
		symnames[sym.DELETE] = "DELETE";
		symnames[sym.UPDATE] = "UPDATE";
		symnames[sym.SET] = "SET";
		symnames[sym.CREATE] = "CREATE";
		symnames[sym.TABLE] = "TABLE";
		symnames[sym.ALTER] = "ALTER";
		symnames[sym.DROP] = "DROP";
		symnames[sym.ADD] = "ADD";
		symnames[sym.DEFAULT] = "DEFAULT";
		symnames[sym.VIEW] = "VIEW";
		symnames[sym.ORDER] = "ORDER";
		symnames[sym.BY] = "BY";
		symnames[sym.ASC] = "ASC";
		symnames[sym.DESC] = "DESC";
		symnames[sym.PRIMARY] = "PRIMARY";
		symnames[sym.KEY] = "KEY";
		symnames[sym.FOREIGN] = "FOREIGN";
		symnames[sym.CHECK] = "CHECK";
		symnames[sym.INT] = "INT";
		symnames[sym.TIMES] = "TIMES";
		symnames[sym.BETWEEN] = "BETWEEN";
		symnames[sym.IN] = "IN";
		symnames[sym.LBRACK] = "LBRACK";
		symnames[sym.RBRACK] = "RBRACK";
		symnames[sym.DISTINCT] = "DISTINCT";
		symnames[sym.TOP] = "TOP";
		symnames[sym.PERCENT] = "PERCENT";
		symnames[sym.INNER] = "INNER";
		symnames[sym.LEFT] = "LEFT";
		symnames[sym.RIGHT] = "RIGHT";
		symnames[sym.FULL] = "FULL";
		symnames[sym.JOIN] = "JOIN";
		symnames[sym.DOT] = "DOT";
		symnames[sym.UNION] = "UNION";
		symnames[sym.ALL] = "ALL";
		symnames[sym.DATABASE] = "DATABASE";
		symnames[sym.NULL] = "NULL";
		symnames[sym.UNIQUE] = "UNIQUE";
		symnames[sym.COLUMN] = "COLUMN";
		symnames[sym.CONSTRAINT] = "CONSTRAINT";
		symnames[sym.INDEX] = "INDEX";
		symnames[sym.ON] = "ON";
		symnames[sym.TRUNCATE] = "TRUNCATE";
		
	}

}
